<%@page language="java" pageEncoding="UTF-8"%>    
<%@page contentType="text/html; charset=UTF-8"%>




<%  
	String path = request.getContextPath();
	String searchkey = request.getParameter("searchkey");
	String searchtype = request.getParameter("searchtype");
	
	System.out.println(searchkey);
    System.out.println(searchtype);
    
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>   
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>项目信息－国家安科网</title>
<link href="<%=path%>/common1/css/layout.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/common1/css/user.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path%>/includes/styleBase/js/jquery.js"></script>

<script language="javascript">



//找项目函数,从/achieve/js/setcondition.js文件中复制
function doSearch_kjcg()
{      
	  var con_item_3 = $("#item_3").val();
       
      if (con_item_3 == "" )
      {
        	alert("请选择检索词，谢谢！");
        	return;
      }
     
      var v_condition = " 1=1 ";
      var v_condition1 = "";
      var v_condition2 = ""; 
      $("#topicname").val(con_item_3);  
   
      //标题
    if  (con_item_3 != "")
    {  	//v_condition1 = "( Kjcg_Item_3 like '%" + con_item_3 + "%' or  Kjcg_Item_9 like '%" +  con_item_3 + "%')";
        v_condition1 = "( Kjcg_Item_3 like '%" + con_item_3 + "%' or  Kjcg_Item_9 like '%" +  con_item_3 + "%'" + " or Kjcg_Item_13_1 like '%" + con_item_3 + "%')";
    }
     
     //检索词          
    if  (con_item_3!="")
    {  
        if (con_item_3.indexOf(" ") != "-1") {
           var topics =new Array();
           topics = con_item_3.split(" ");
           var i;
           var KeywordS;
           for(i=0;i<topics.length;i++) {
              if (i==0) 
                  KeywordS = " KjcgID in (select KjcgID from T_KjcgKey where Keyword = '"+ topics[i] +"')";
              else
                  KeywordS = KeywordS + " and KjcgID in (select KjcgID from T_KjcgKey where Keyword = '"+ topics[i] +"')";
           }
           v_condition2 = KeywordS ;  
        }
        else {
           v_condition2 =  "(KjcgID in (select KjcgID from T_KjcgKey where Keyword = '"+con_item_3+"'))"  ;
        }
       
     } 
     
     if  (con_item_3!="")
     v_condition =  v_condition1 + " or " + v_condition2 ;
       
     $("#key").val(v_condition);
	
     document.getElementById("searchform").submit(); 
}



//找专家搜索,从/expert/js/setcondition.js文件中复制代码
function doSearch_expert()
{      var con_item_180 = $("#item_180").val();
       
       if (con_item_180 == "" )
      {
        alert("请选择检索词，谢谢！");
        return;
       }
     
      var v_condition = " 1=1 ";
      var v_condition1 = "";
      var v_condition2 = ""; 
      var v_condition3 = ""; 
      $("#topicname").val(con_item_180);
   
      
    if  (con_item_180!="")
    { //姓名
    	v_condition1 =  " charindex('" + con_item_180 + "', Item_180)>0" ;
       
      //从事专业
        v_condition2 =  " charindex('" + con_item_180 + "', WorkSpeciality)>0" ;

      //单位
        v_condition3 =  " charindex('" + con_item_180 + "', Item_185)>0" ;

       v_condition =  v_condition1 + " or " + v_condition2 + " or " + v_condition3; 
       $("#key").val(v_condition);
       document.getElementById("searchform").submit(); 
    }
   
}



//找机构搜索,从/unit/js/setcondition.js文件中复制代码 
//但去掉了 地区province 和新能源分类NewEnergyClass查询条件
function doSearch_unit()
{      
	   var con_item_9 = document.getElementById("item_9").value;

       if (con_item_9 == "")
      {
        alert("请选择检索词，谢谢！");
        return;
       }
     
      var v_condition = " 1=1 ";      
   
      //标题
    if  (con_item_9 != "")
    {  	v_condition = v_condition + " and Item_9 like '%" + con_item_9 + "%'";
    
     if (document.getElementById("topicname").value == "") {
                        document.getElementById("topicname").value = con_item_9;
                }
                else {
                        document.getElementById("topicname").value = document.getElementById("topicname").value + "+" +con_item_9;
                }     
        
    }
                                         
     document.getElementById("key").value=v_condition;
    
     document.forms["searchform"].submit(); 
   
}


function doSearch_Kjcg_All(){
	document.getElementById("key").value="1=1";
	document.forms["searchform"].submit();
}

function doSearch_Expert_All(){
	document.getElementById("key").value="1=1";
	document.forms["searchform"].submit();
}

function doSearch_Unit_All(){
	document.getElementById("key").value="1=1";
	document.forms["searchform"].submit();
}


var topicname = "";
$("document").ready(function()
{
	var searchtype = "<%=searchtype%>";
	var searchkey = "<%=searchkey%>";
	
	if(searchtype=="1"){//找成果
		$("#item_3").val(searchkey);
		$("#searchform").attr("action","<%=path%>/achieve1/search_results.jsp");
		doSearch_kjcg();
	}else if(searchtype=="2"){
		$("#item_180").val(searchkey);
		$("#searchform").attr("action","<%=path%>/expert1/search_results.jsp");
		doSearch_expert();
	}else if(searchtype=="3"){
		$("#item_9").val(searchkey);
		$("#searchform").attr("action","<%=path%>/unit1/search_results.jsp");
		doSearch_unit();
	}else if(searchtype=="1_all"){
		$("#searchform").attr("action","<%=path%>/achieve1/achieveIndex.jsp");
		doSearch_Kjcg_All();
	}else if(searchtype=="2_all"){
		$("#searchform").attr("action","<%=path%>/expert1/search_results.jsp");
		doSearch_Expert_All();
	}else if(searchtype=="3_all"){
		$("#searchform").attr("action","<%=path%>/unit1/search_results.jsp");
		doSearch_Unit_All();
	}
	
	
});

</script>		
</head>
<body>
	<form id="searchform" name="searchform" action="" method="post" >
		 <!--成果搜索条件-->
		 <input type="hidden" name="item_3" id="item_3" size="32" style="margin-top:2px;" />
		 
		 <!--专家搜索条件-->
		 <input type="hidden" name="item_180" id="item_180" size="40" class="input_text_grey" value="" />
		 
		 <!--机构搜索条件-->
		 <input type="hidden" name="item_9" id="item_9" size="30" class="input_text_grey" value="" />
		 
		 <!-- 公用input -->
         <input type="hidden" name="topicname" id="topicname" value=""/>
      　  <input type="hidden" name="key" id="key" value=""/>
	</form>
</body>
</html>





